package com.ruoyi.project.module.zxm;


import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.project.domain.YqgInformationRoom;
import com.ruoyi.project.service.IYqgInformationRoomService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/zxm/lobby")
public class LobbyController {

    @Resource
    private IYqgInformationRoomService roomService;
    //查大厅的
    @RequestMapping("/room")
    public AjaxResult roomLobby(){
        YqgInformationRoom yqgInformationRoom = new YqgInformationRoom();
        yqgInformationRoom.setRoomType("003");
        List<YqgInformationRoom> result = roomService.selectYqgInformationRoomList(yqgInformationRoom);
        return AjaxResult.success(result);
    }

    //根据房间号查询
    @RequestMapping("/latter")
    public AjaxResult latter()
    {

        List<YqgInformationRoom>  result = roomService.selectLatterInforamtion();
        return AjaxResult.success(result);
    }

    //根据房间信息查询房间状态
    @RequestMapping("/status/{number}")
    public AjaxResult CountNumber(@PathVariable String number) throws ParseException {
        YqgInformationRoom yqgInformationRoom = roomService.selectByRoomNumber(number);
        ArrayList<YqgInformationRoom> result = new ArrayList<>();
        result.add(yqgInformationRoom);
        return AjaxResult.success(result);

    }

}
